home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / defappleevents / test-to-self.Lisp < prev   
Encoding:
Text File  |  1994-09-12  |  1.0 KB  |  43 lines  |  [TEXT/CCL2]

  1. (require 'appleevent-toolkit)
  2. (use-package "DEFAPPLEEVENTS")
  3.  
  4. ;; Define an applevent format for sending data
  5. ;;
  6. (defappleevent send :|MACL| :|send|
  7.   ((direct-object #$keyDirectObject))
  8.   ())
  9.  
  10. (defvar *sdo* nil)
  11.  
  12. ;; Handle the SEND event by printing the data and storing it in the
  13. ;; global *sdo*
  14.  
  15. (defun print-sent-thing (application appleevent reply refcon)
  16.   (declare (ignore application reply refcon))
  17.   (setf *sdo* (send-direct-object appleevent))
  18.   (print *sdo* *standard-output*))
  19.  
  20. (install-appleevent-handler :|MACL| :|send| #'print-sent-thing)
  21.  
  22. ;; Allocate some records
  23. ;;
  24. (defvar aerecord (make-record :appleevent))
  25. (defvar target (make-record :aedesc))
  26.  
  27.  
  28. (create-self-target target)
  29. ;(choose-appleevent-target target)
  30.  
  31. (defun send-thing (thing)
  32.   (send-appleevent (make-send aerecord target
  33.                               :direct-object thing)
  34.                    (%null-ptr)))
  35.  
  36. #|
  37. (send-thing 666)
  38. (send-thing "a string")
  39. (send-thing `(:aelist integer 3 string "STRING" float ,pi))
  40.  
  41. (#_aedisposedesc aerecord)
  42. (#_aedisposedesc target)
  43. |#